<?php
namespace heihei\filters\auth;

use yii;
use yii\filters\auth\CompositeAuth AS BaseCompositeAuth;

/**
 * CompositeAuth是一个动作过滤器，同时支持多种身份验证方法，并且支持
 *
 */
class CompositeAuth extends BaseCompositeAuth
{
    /**
     * {@inheritdoc}
     */
    public function beforeAction($action)
    {
        $user = Yii::$app->getUser();
        $session = Yii::$app->getSession();
        if($user->enableSession && $session->getHasSessionId() && !$user->getIsGuest()){
            return true;
        }
        return parent::beforeAction($action);
    }
}
